<!--Copyright (C) Kherty.  All rights reserved.-->
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:oui="clr-namespace:OpenLS.UI"
    xmlns:ouit="clr-namespace:OpenLS.UI.Themes"
                    x:Class="OpenLS.UI.RibbonResources">
    <ResourceDictionary.MergedDictionaries>
        <oui:GroupResources/>
        <oui:BoxResources/>
        <ouit:ListBoxItemResources/>
        <oui:ComboBoxResources/>
        <ouit:ToggleButtonResources/>
        <ouit:ButtonResources/>
        <ouit:CheckBoxResources/>
        <ouit:MenuResources/>
        <ouit:TabItemResources/>
        <ouit:GalleryResources/>
        <ouit:ToolTipResources />

    </ResourceDictionary.MergedDictionaries>
    
    <ControlTemplate TargetType="{x:Type oui:Ribbon}" x:Key="ribbonTabControlTemplateExpanded">
        <Grid  Background="{DynamicResource {x:Static oui:OfficeBrushes.RibbonBackgroundKey}}" ClipToBounds="True" x:Name="Grid" SnapsToDevicePixels="True" KeyboardNavigation.TabNavigation="Local">
            <Grid.ColumnDefinitions>
                <ColumnDefinition x:Name="applicationMenuColumn" Width="Auto"/>
                <ColumnDefinition x:Name="ColumnDefinition0" Width="*" />
                <ColumnDefinition x:Name="ColumnDefinition1" Width="0"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition x:Name="RowDefinition0" Height="Auto"/>
                <RowDefinition x:Name="RowDefinition1" Height="96"/>
            </Grid.RowDefinitions>
            <oui:SqueezePanel HorizontalAlignment="Left" Background="{DynamicResource {x:Static oui:OfficeBrushes.RibbonBackgroundKey}}" Margin="4,0,0,0" Grid.Row="0" Grid.Column="1"
                        x:Name="HeaderPanel" IsItemsHost="True" KeyboardNavigation.TabIndex="1" Panel.ZIndex="1"/>
            <ContentPresenter Content="{TemplateBinding ApplicationMenu}"></ContentPresenter>
            <Border Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Name="ContentPanel" BorderBrush="{TemplateBinding BorderBrush}"
              BorderThickness="0,0,1,1" KeyboardNavigation.TabIndex="2" KeyboardNavigation.TabNavigation="Local"
              KeyboardNavigation.DirectionalNavigation="Contained" Margin="2 0 2 2" CornerRadius="4">
                <Border x:Name="Border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" CornerRadius="4">
                    <Border Background="{TemplateBinding Background}" x:Name="Border1" CornerRadius="4">
                        <ContentPresenter Margin="{TemplateBinding Padding}" x:Name="PART_SelectedContentHost"
                              SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Content="{TemplateBinding SelectedContent}" ContentTemplate="{TemplateBinding SelectedContentTemplate}" ContentSource="SelectedContent"/>
                    </Border>
                </Border>
            </Border>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="TabStripPlacement" Value="Bottom">
                <Setter Property="Grid.Row" Value="1" TargetName="HeaderPanel"/>
                <Setter Property="Grid.Row" Value="0" TargetName="ContentPanel"/>
                <Setter Property="Height" Value="*" TargetName="RowDefinition0"/>
                <Setter Property="Height" Value="Auto" TargetName="RowDefinition1"/>
                <Setter Property="Margin" Value="2,0,2,2" TargetName="HeaderPanel"/>
                <Setter Property="Background">
                    <Setter.Value>
                        <LinearGradientBrush StartPoint="0,1" EndPoint="0,0">
                            <GradientStop Offset="0" Color="#FFFCFCFE"/>
                            <GradientStop Offset="1" Color="#FFF4F3EE"/>
                        </LinearGradientBrush>
                    </Setter.Value>
                </Setter>
            </Trigger>
            <Trigger Property="TabStripPlacement" Value="Left">
                <Setter Property="Grid.Row" Value="0" TargetName="HeaderPanel"/>
                <Setter Property="Grid.Row" Value="0" TargetName="ContentPanel"/>
                <Setter Property="Grid.Column" Value="0" TargetName="HeaderPanel"/>
                <Setter Property="Grid.Column" Value="1" TargetName="ContentPanel"/>
                <Setter Property="Width" Value="Auto" TargetName="ColumnDefinition0"/>
                <Setter Property="Width" Value="*" TargetName="ColumnDefinition1"/>
                <Setter Property="Height" Value="*" TargetName="RowDefinition0"/>
                <Setter Property="Height" Value="0" TargetName="RowDefinition1"/>
                <Setter Property="Margin" Value="2,2,-1,2" TargetName="HeaderPanel"/>
                <Setter Property="Background">
                    <Setter.Value>
                        <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
                            <GradientStop Offset="0" Color="#FFFCFCFE"/>
                            <GradientStop Offset="1" Color="#FFF4F3EE"/>
                        </LinearGradientBrush>
                    </Setter.Value>
                </Setter>
            </Trigger>
            <Trigger Property="TabStripPlacement" Value="Right">
                <Setter Property="Grid.Row" Value="0" TargetName="HeaderPanel"/>
                <Setter Property="Grid.Row" Value="0" TargetName="ContentPanel"/>
                <Setter Property="Grid.Column" Value="1" TargetName="HeaderPanel"/>
                <Setter Property="Grid.Column" Value="0" TargetName="ContentPanel"/>
                <Setter Property="Width" Value="*" TargetName="ColumnDefinition0"/>
                <Setter Property="Width" Value="Auto" TargetName="ColumnDefinition1"/>
                <Setter Property="Height" Value="*" TargetName="RowDefinition0"/>
                <Setter Property="Height" Value="0" TargetName="RowDefinition1"/>
                <Setter Property="Margin" Value="-1,2,2,2" TargetName="HeaderPanel"/>
                <Setter Property="Background">
                    <Setter.Value>
                        <LinearGradientBrush StartPoint="1,0" EndPoint="0,0">
                            <GradientStop Offset="0" Color="#FFFCFCFE"/>
                            <GradientStop Offset="1" Color="#FFF4F3EE"/>
                        </LinearGradientBrush>
                    </Setter.Value>
                </Setter>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate TargetType="{x:Type oui:Ribbon}" x:Key="ribbonTabControlTemplateCollapsed">
        <Grid  Background="{DynamicResource {x:Static oui:OfficeBrushes.RibbonBackgroundKey}}" ClipToBounds="True" x:Name="Grid" SnapsToDevicePixels="True"
               KeyboardNavigation.TabNavigation="Local">

            <Grid.ColumnDefinitions>
                <ColumnDefinition x:Name="applicationMenuColumn" Width="Auto"/>
                <ColumnDefinition x:Name="ColumnDefinition0" Width="*" />
                <ColumnDefinition x:Name="ColumnDefinition1" Width="0"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition x:Name="RowDefinition0" Height="Auto"/>
            </Grid.RowDefinitions>
            <Label Visibility="Hidden" Name="Anchor" Grid.Row="0"/>

<!--            <StackPanel Orientation="Horizontal"  x:Name="HeaderPanel" IsItemsHost="True" KeyboardNavigation.TabIndex="1" Panel.ZIndex="1" PreviewMouseDown="Button_OnPreviewMouseDown"></StackPanel> -->
            <oui:SqueezePanel HorizontalAlignment="Left" Background="Transparent" Margin="4,0,0,0" Grid.Row="0" Grid.Column="1"
                        x:Name="HeaderPanel" PreviewMouseDown="Button_OnPreviewMouseDown" IsItemsHost="True" KeyboardNavigation.TabIndex="1" Panel.ZIndex="1"/>
            <ContentPresenter Content="{TemplateBinding ApplicationMenu}"></ContentPresenter>

            <Popup Name="PART_Popup" AllowsTransparency="True"
                   Placement="Bottom" PlacementTarget="{Binding ElementName=Anchor}" PopupAnimation="Scroll">
                <Popup.BitmapEffect>
                    <DropShadowBitmapEffect Direction="270"/>
                </Popup.BitmapEffect>

                <Border Width="{Binding ElementName=Grid, Path=ActualWidth}" Height="96" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Name="ContentPanel" BorderBrush="{TemplateBinding BorderBrush}"
                BorderThickness="0,0,1,1" KeyboardNavigation.TabIndex="2" KeyboardNavigation.TabNavigation="Local"
                KeyboardNavigation.DirectionalNavigation="Contained" Margin="2 0 2 2" CornerRadius="4">
                    <Border x:Name="Border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" CornerRadius="4">
                        <Border Background="{TemplateBinding Background}" x:Name="Border1" CornerRadius="4">
                            <ContentPresenter Margin="{TemplateBinding Padding}" x:Name="PART_SelectedContentHost"
                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Content="{TemplateBinding SelectedContent}" ContentTemplate="{TemplateBinding SelectedContentTemplate}" ContentSource="SelectedContent"/>
                        </Border>
                    </Border>
                </Border>
            </Popup>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="State" Value="Open">
                <Setter TargetName="PART_Popup" Property="IsOpen" Value="True" />
            </Trigger>
            <Trigger Property="State" Value="Minimized">
                <Setter TargetName="PART_Popup" Property="IsOpen" Value="False" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
    <Style TargetType="{x:Type oui:Ribbon}">
                <Style.Resources>
            <Style TargetType="{x:Type oui:Group}" BasedOn="{StaticResource {x:Static oui:Styles.GroupStyleKey}}"/>
            <Style TargetType="{x:Type oui:Box}" BasedOn="{StaticResource {x:Static oui:Styles.BoxStyleKey}}"/>
            <Style TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Static oui:Styles.RibbonButtonStyleKey}}"/>
            <Style TargetType="{x:Type Menu}" BasedOn="{StaticResource {x:Static oui:Styles.RibbonMenuStyleKey}}"/>
            <Style TargetType="{x:Type MenuItem}" BasedOn="{StaticResource {x:Type MenuItem}}"/>
            <Style TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource {x:Static oui:Styles.RibbonToggleButtonStyleKey}}"/>
            <Style TargetType="{x:Type CheckBox}" BasedOn="{StaticResource {x:Static oui:Styles.RibbonCheckBoxStyleKey}}"/>
            <Style TargetType="{x:Type ComboBox}" BasedOn="{StaticResource {x:Static oui:Styles.RibbonComboBoxStyleKey}}"/>
            <Style TargetType="{x:Type ToolTip}" BasedOn="{StaticResource {x:Static oui:Styles.ToolTipStyleKey}}"/>
            <!-- <Style TargetType="{x:Type oui:HighlightComboBox}" BasedOn="{StaticResource {x:Static oui:Styles.RibbonComboBoxStyleKey}}"/> -->
        </Style.Resources>

        <Setter Property="FocusManager.IsFocusScope" Value="True"/>
        <Setter Property="Background" Value="{DynamicResource {x:Static oui:OfficeBrushes.RibbonContentBackgroundKey}}" />
        <Setter Property="Template" Value="{StaticResource ribbonTabControlTemplateCollapsed}"></Setter>
        <Setter Property="FocusManager.IsFocusScope" Value="True"/>
        <Setter Property="BorderBrush" Value="{DynamicResource {x:Static oui:OfficeBrushes.RibbonBorderBrushKey}}" />
        <Setter Property="ItemContainerStyle" Value="{StaticResource ribbonTabItemStyle}"/>
        <Setter Property="TextElement.Foreground" Value="{DynamicResource {x:Static oui:OfficeBrushes.TextForegroundKey}}"/>
        <Style.Triggers>
            <Trigger Property="State" Value="Expanded">
                <Setter Property ="Template" Value="{StaticResource ribbonTabControlTemplateExpanded}"/>
            </Trigger>

        </Style.Triggers>


    </Style>
    
</ResourceDictionary>